extend personLeft.pug

block append pageStyle
	link(href='${relativePath}/static/css/personCenter/personIndex.css' type="text/css" rel="stylesheet")

block personRight
	div.rightContent.fl
		div.goodsContent
			div.goodsTitle
				ul
					li.goodName 商品名称
					li.goodsMsg 商品信息
					li.unit 单价
					li.goodNum 数量
					li.allCount 总价
					li.tradStatus 交易状态
					li.tradOpera 交易操作
			div.allLists
				//- 列表内容
				
			div.clear
	//- 订单列表模板
	script#orderLists(type="text/html")
		| {{set data = data.data}}
		| {{each data arr}}
		div.listOne(orderid="{{arr.order_id}}" type="{{arr.order_type}}" skuid="{{arr.sku_id}}")
			| <div class="listTop {{if arr.order_state == 0 || arr.order_state == 120}} gray {{/if}}">
			|	<span class="time"> {{arr.create_time}}</span>
			|	<span class="order"> 订单号：{{arr.order_sn}}</span>
			|	<span> {{arr.company_name}}</span>
			| {{if arr.expiry_time != 0}}
			| <div class="countdown fr" data-endtime="<%=getExpiryTime(arr.expiry_time)%>" style="display:inline-block;">
			//- | 	<span class="secondTime fr"> {{arr.expiry_time}}</span>
			| 		<span class="secondTime fl" ct-h>00</span><i class="fl">:</i><span class="secondTime secondTime01 fl" ct-mi>00</span><i class="fl">:</i><span class="secondTime secondTime02 fl" ct-s>00</span>
			| </div>
			| {{/if}}
			| {{if arr.order_state == 0 || arr.order_state == 120}}
			| <span class="delete delete1 fr"></span>
			| {{/if}}
			| </div>
			div.listContent
				div.commentsBox
					div.listLeft.fl
						div.imgBox.fl
							img(src="{{arr.img}}")
						div.imgTxt.fl
							<h3> {{arr.goods_name}}</h3>
							p 备注：{{arr.member_explain}}
					div.msgBoxList.fl
						| {{set list = arr.sku_list}}
						| {{each list temp}}
						p {{temp.spec_name}}：{{temp.opt_name}}
						| {{/each}}
					div.unitBoxList.fl
						p.unit {{arr.goods_price}}
					div.numberBoxList.fl {{arr.goods_num}}
					div.allCounts.fl {{arr.amount_price}}
					div.tradStatusList.fl
						| {{if arr.order_state == 0}}
						p 系统取消
						| {{else if arr.order_state == 10}}
						p 客户取消
						| {{else if arr.order_state == 20}}
						p 待确认, 未付款
						| {{else if arr.order_state == 30}}
						p 已确认, 未付款
						| {{else if arr.order_state == 40}}
						p 已付款, 未付完
						| {{else if arr.order_state == 50}}
						p 已付款
						| {{else if arr.order_state == 60}}
						p 待收货
						| {{else if arr.order_state == 70}}
						p 已收货
						| {{else if arr.order_state == 80}}
						p 退款成功
						| {{else if arr.order_state == 83 || arr.order_state == 84 || arr.order_state == 85}}
						p 退款中
						| {{else if arr.order_state == 87 || arr.order_state == 88 || arr.order_state == 89}}
						p 商家同意售后
						| {{else if arr.order_state == 81 || arr.order_state == 82 || arr.order_state == 86}}
						p 商家拒绝售后
						| {{else if arr.order_state == 90}}
						p 商家拒接订单
						| {{else if arr.order_state == 100}}
						p 已完成,未结算
						| {{else if arr.order_state == 120}}
						p 已完成,已结算
						| {{/if}}
						p
							a.orderLinkDatail(href="javascript:;") 订单详情
					div.tradOperation.fl
						p
							a.reSubmit.rightNow.goPj(href="javascript:") 评  价
						
				div.clear
			| {{if arr.order_type == 1 }}
			//- 图片列表
			div.designBox
				| {{set imgs = arr.order_img}}
				| {{if imgs.length != 0}}
				div.line
				div.designImg
					span.pic.fl 效果图：
					ul.fl
						| {{each imgs img}}
						li.fl
							img(src="{{img}}")
						| {{/each}}
				| {{/if}}
				| {{set txt = arr.order_files}}
				| {{if txt.length != 0}}
				div.designImg.closeure
					span.pic.txt.fl &nbsp;&nbsp;&nbsp;&nbsp;附件：
					| {{each txt fjHerf}}
					div.txtBox.fl
						p.list
							a(href="{{fjHerf}}" target="_blank") 标识汇-智能商城
							span.delete.fr
					| {{/each}}
				| {{/if}}
			| {{/if}}

			//- 查看评价内容
			| {{if arr.contents != null}}
			div.lookComment
				p.star
					| {{if arr.point =                                                         = 1}}
					i.iconStar.current
					i.iconStar
					i.iconStar
					i.iconStar
					i.iconStar
					| {{else if arr.point == 2}}
					i.iconStar.current
					i.iconStar.current
					i.iconStar
					i.iconStar
					i.iconStar
					| {{else if arr.point == 3}}
					i.iconStar.current
					i.iconStar.current
					i.iconStar.current
					i.iconStar
					i.iconStar
					| {{else if arr.point == 4}}
					i.iconStar.current
					i.iconStar.current
					i.iconStar.current
					i.iconStar.current
					i.iconStar
					| {{else if arr.point == 5}}
					i.iconStar.current
					i.iconStar.current
					i.iconStar.current
					i.iconStar.current
					i.iconStar.current
					| {{/if}}
					//- | <span>满意</span>
				p.commentTxt {{arr.contents}}
				ul.imgBox
					| {{set lists = arr.contentImgs}}
					| {{each lists imgList}}
					li
						img(src="{{imgList}}")
					| {{/each}}
			| {{/if}}
			div.clear
		| {{/each}}

	//- 分页
	div.pageBox
		nav.pageNav
			div.paginationOne.page

block append pageScript

	script.
		
		$(function(){
			//- 当前选中
			$("#myPj").addClass("current").siblings("li").removeClass("current");
			$(".dpj").addClass("current").siblings("a").removeClass("current");
			//- 全部订单
			//- 点击全部订单、
			function allOrder(pageNum,dateType,start_time,finish_time,order_state){
				$.getJSON(shopIp+"/Order/orderList?callback=?",{
					os:"web",
					userToken:token,
					type:"buyer",
					size:4,
					page:pageNum,
					dateType:dateType,
					order_state:70,
					is_comment:1
				},function(data){
					var dataTwo = data.data;
					var tempList = template("orderLists",data);
					if(dataTwo.data == null ) {
						$(".allLists").html("<img class='imgBig' src='${relativePath}/static/imgs/zw.png'/>");
						$(".allLists").css("text-align","center");
					} else{
						$(".allLists").html(tempList);
					}
					$(".page").html("").pagination({
						pageCount : data.data.pageCount,
						current : pageNum,
						keepShowPN : true,
						count : 2,
						homePage : "1",
						endPage : data.data.pageCount,
						coping : true,
						prevContent : "< 上一页",
						nextContent : "下一页 >",
						callback : function(page) {
							allOrder(page.getCurrent());
						}
					});
				})
			}
			allOrder(1,"","","","");

			//- 查看评论
			$(".allLists").on("click","a.lookPj",function(){
				$(this).closest(".lookComment").show();
			})
			//- 去评价
			$(".allLists").on("click",".goPj",function() {
				window.location.href="myEvaluation.html?order_id="+$(this).closest(".listOne").attr("orderid");
			})

			//- 点击删除
			$(".allLists").on("click",".delete1",function(){
				$(this).closest(".listOne").remove();
			})

			//- 点击进入订单详情
			$(".allLists").on("click",".orderLinkDatail",function(){

				if($(this).closest(".listOne").attr("type") == 0) {
					window.location.href = "../shopping/orderDetails_d.html?order_id=" + $(this).closest(".listOne").attr("orderid");
				}else if($(this).closest(".listOne").attr("type") == 1) {
					if($(this).closest(".listOne").attr("skuid") == "") {
						window.location.href = "../shopping/neworderDetails.html?order_id=" + $(this).closest(".listOne").attr("orderid");
					}else{
						window.location.href = "../shopping/orderDetails.html?order_id=" + $(this).closest(".listOne").attr("orderid");
					}
				}else if($(this).closest(".listOne").attr("type") == 2) {
					window.location.href = "../shopping/designorderDetails.html?order_id=" + $(this).closest(".listOne").attr("orderid");
				}else if($(this).closest(".listOne").attr("type") == 3) {
					window.location.href = "../shopping/installorderDetails.html?order_id=" + $(this).closest(".listOne").attr("orderid");
				}else if($(this).closest(".listOne").attr("type") == 4) {
					window.location.href = "../shopping/carorderDetails.html?order_id=" + $(this).closest(".listOne").attr("orderid");
				}else if($(this).closest(".listOne").attr("type") == 5){
					window.location.href = "../shopping/equiorderDetails.html?order_id=" + $(this).closest(".listOne").attr("orderid");
				}	

			})

			//- 点击立即付款
			$(".allLists").on("click",".planking",function() {
				window.location = "../shopping/payment.html?order_id="+$(this).closest(".listOne").attr("orderid");
			})
			//- 点击头像进个人资料
			$(".headPortBox  img").click(function() {
				window.location.href = "personData.html";
			})
		})


